﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Small.Html.UI;
using Small.Util.Reflection;


namespace Small.Html.Options
{
   public class TreeListOptions<T>:BaseExpress
    {
   
        private string expandClass;

       /// <summary>
       /// 展开节点样式
        /// default : samll_treelist_expanditem
       /// </summary>
        public string ExpandClass
        {
            get {
                if (string.IsNullOrEmpty(expandClass)) 
                {
                    expandClass = "samll_treelist_expanditem";
                }
                return expandClass; }
            set { expandClass = value; }
        }
        private int paddingLeft = 10;

        public int PaddingLeft
        {
            get { return paddingLeft; }
            set { paddingLeft = value; }
        }
        private Expression<Func<T, object>> key;

       /// <summary>
       /// 节点ID
       /// </summary>
        public Expression<Func<T, object>> Key
        {
            get { return key; }
            set { key = value; }
        }
        private Expression<Func<T, object>> expand;

       /// <summary>
       /// 展开节点名称
       /// </summary>
        public Expression<Func<T, object>> Expand
        {
            get { return expand; }
            set { expand = value; }
        }
        private Expression<Func<T, object>> parentID;

       /// <summary>
       /// 父节点ID
       /// </summary>
        public Expression<Func<T, object>> ParentID
        {
            get { return parentID; }
            set { parentID = value; }
        }
        private Expression<Func<T, object>>[] linkFields;

       /// <summary>
       /// 超链接字段
       /// </summary>
        public Expression<Func<T, object>>[] LinkFields
        {
            get { return linkFields; }
            set { linkFields = value; }
        }
        private Expression<Func<T, object>>[] fields;

       /// <summary>
       /// 显示字段
       /// </summary>
        public Expression<Func<T, object>>[] Fields
        {
            get { return fields; }
            set { fields = value; }
        }
       
       //数据源
        private IList<T> list ;

       /// <summary>
       /// 数据源
       /// </summary>
        public IList<T> List
        {
            get { return list; }
            set { list = value; }
        }
       
       
        private Int32 level;
       /// <summary>
       /// 深度
       /// </summary>
        public Int32 Level
        {
            get { return level; }
            set { level = value; }
        }


        private string linkClass;

       /// <summary>
       /// 超链接
       /// </summary>
        public string LinkClass
        {
            get {

                if (string.IsNullOrEmpty(linkClass)) 
                {
                 linkClass="small_treelist_link";
                }
                return linkClass; }
            set { linkClass = value; }
        }

        private string tableClass;

       /// <summary>
       /// 列表样式
        /// default  small_treelist
       /// </summary>
        public string TableClass
        {
            get {

                if (string.IsNullOrEmpty(tableClass)) 
                {
                    tableClass = "small_treelist";
                }
                return tableClass; }
            set { tableClass = value; }
        }
        private string collapseClass;

       /// <summary>
       /// 展开后样式
        /// default  samll_treelist_collapse
       /// </summary>
        public string CollapseClass
        {
            get {

                if (string.IsNullOrEmpty(collapseClass)) 
                {
                    collapseClass = "samll_treelist_collapse";
                }
                return collapseClass; }
            set { collapseClass = value; }
        }
        private Int32 paddingSpace;

       /// <summary>
       /// 父子节点paddingspace长度
       /// default 20
       /// </summary>
        public Int32 PaddingSpace
        {
            get {

                if (paddingSpace == 0) 
                {
                    paddingSpace = 20;
                }
                return paddingSpace; }
            set { paddingSpace = value; }
        }


        private string itemClass;

       /// <summary>
       /// 没有父节点样式
       /// </summary>
        public string ItemClass
        {
            get {

                if (string.IsNullOrEmpty(itemClass)) 
                {
                    itemClass = "small_treelist_item";
                }
                return itemClass; }
            set { itemClass = value; }
        }
    }
}
